include('shared.lua')

function ENT:FakeInit()
	
	self.BdRadius = math.ceil( self:BoundingRadius() ) - 5
	
	self.emitter = ParticleEmitter( self:GetPos() )

	self.NextParticle = 0
end

function ENT:Think()

	if CurTime() < self.NextParticle then
		return
	end
	
	self.NextParticle = CurTime() + 0.13
		
	
	
	local EntPos = self:GetPos()
	
	local GravityPos = Vector(0,0,300)
	GravityPos:Rotate( self:GetAngles() )
	
	
	for i=0, 4 do
		local RandAngle = math.Rand( 0, math.pi * 2)
	
		local ParticlePos = Vector( math.cos(RandAngle) * self.BdRadius, math.sin(RandAngle) * self.BdRadius, 5 )
		ParticlePos:Rotate( self:GetAngles() )
		local vPos = EntPos + ParticlePos
		
		
		
		local particle = self.emitter:Add( "effects/spark", vPos )
		
		if (particle) then
			
			particle:SetVelocity( (EntPos - vPos) * 1.2)
			particle:SetLifeTime( 0 )
			particle:SetDieTime( math.Rand( 0.7, 0.9 ) )
			particle:SetStartAlpha( math.Rand( 200, 255 ) )
			particle:SetEndAlpha( 0 )
			particle:SetStartSize( 2 )
			particle:SetEndSize( 0 )
			particle:SetRoll( math.Rand(0, 360) )
			particle:SetRollDelta( 0 )
			
			particle:SetAirResistance( 0 )
			particle:SetGravity( GravityPos )
			particle:SetCollide( false )
			particle:SetBounce( 0.0 )
			
		end
	end

end


function ENT:FakeRemove()
	self.emitter:Finish()
end